<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>图书详情</title>
    <script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.6.1/jquery.min.js"></script>
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css" integrity="sha384-HSMxcRTRxnN+Bdg0JdbxYKrThecOKuH5zCYotlSAcp1+c8xmyTe9GYg1l9a69psu" crossorigin="anonymous"/>
    <script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>
</head>
<body>

<div th:insert="head.html"></div>


<div class="container-fluid" id="app" style="margin-top: 180px;margin-bottom: 100px">

    <div class="row">
        <div class="col-md-4">
            <div class="thumbnail">
                <img :src="goods.productImgsrc" alt="...">
            </div>
        </div>
        <div class= "col-md-8">
            <p>品名 : <span v-text="goods.productName"></span></p>
            <p>价格 : <span v-text="goods.productPrice" ></span></p>

            <br/>
            <a class="btn btn-success" >加入购物车</a>
        </div>
    </div>

</div>

<script>


    let app = new Vue({
        el:"#app",
        data:{
            goods:{
                id:-1,
                productName:'',
                productPrice:-1.0,
                productImgsrc:'',
                produceTypeId:'',
                createdTime:''
            }

        },
        methods:{
            initBookInfo(){
                let id = sessionStorage.getItem("productId");
                $.post('/product/toDetail',{id:id}, data=> {
                    this.goods = data
                })

            }
        },
        created(){
            this.initBookInfo();
        }
    })

</script>


</body>
</html>